home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
IRIX 6.2 Applications 1996 May
/
SGI IRIX 6.2 Applications 1996 May.iso
/
dist
/
impr_dev.idb
/
usr
/
impressario
/
src
/
gui_models
/
laserjetPJL
/
resource.c.z
/
resource.c
Wrap
C/C++ Source or Header
|
1996-05-06
|
3KB
|
88 lines
/**************************************************************************
*
* Copyright (c) 1993 Silicon Graphics, Inc.
*
* Permission to use, copy, modify, distribute, and sell this software and
* its documentation for any purpose is hereby granted without fee, provided
* that (i) the above copyright notices and this permission notice appear in
* all copies of the software and related documentation, and (ii) the name of
* Silicon Graphics may not be used in any advertising or publicity relating
* to the software without the specific, prior written permission of Silicon
* Graphics.
*
* THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND,
* EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY
* WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.
*
* IN NO EVENT SHALL SILICON GRAPHICS BE LIABLE FOR ANY SPECIAL, INCIDENTAL,
* INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND, OR ANY DAMAGES WHATSOEVER
* RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER OR NOT ADVISED OF
* THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF LIABILITY, ARISING OUT
* OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*
* SILICON GRAPHICS RESERVES THE RIGHT TO CHANGE FUTURE VERSIONS OF THIS
* SOFTWARE IN ANY MANNER AND AT ANY TIME WITHOUT PRIOR NOTICE.
*
**************************************************************************
*
* File: ps_opts.c
*
* Note to Developer: Modify this file if you are adding or removing
* PostScript file options.
*
* Description: UI and handling routines for PostScript file options.
* Options that fall into this category are those that pertain to
* PostScript files.
*
**************************************************************************/
/*
* resource.c
*
* Simplified ways to get resources
*/
#include <X11/Intrinsic.h>
#include <X11/StringDefs.h>
#include <Xm/Xm.h>
#include "xutil.h"
/*
* char *
* GetResourceString(Widget w, char *name, char *class, char *def)
*
* Description:
* Get a resource string for a widget.
*
* Parameters:
* w Widget to get resource for
* name resource name
* class resource class
* def default value
*
* Returns:
* String value of the resource. Note that if def is non-NULL,
* this will always be valid (in other words, if what you pass in
* as def is guaranteed to be valid, you don't have to check the
* return value of this function)
*/
char *
GetResourceString(Widget w, char *name, char *class, char *def)
{
XtResource res;
char *str;
res.resource_name = name;
res.resource_class = class;
res.resource_type = XtRString;
res.resource_size = sizeof(char *);
res.resource_offset = 0;
res.default_type = XtRString;
res.default_addr = def;
XtGetApplicationResources(w, &str, &res, 1, NULL, 0);
return str ? str : def;
}